package com.pmcc.yn.repository;

import com.pmcc.yn.entity.OrderList;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * Created by xuwanlin on 2019/1/11.
 */
public interface OrderListRepository extends JpaRepository<OrderList,String> {

    Page<OrderList> findAll(Specification<OrderList> spec, Pageable var1);

    OrderList findById(String id);

    OrderList saveAndFlush(OrderList model);

    OrderList findByTechId(String id);

    List<OrderList> findByStoreId(String storeId);

    List<OrderList> findBySerType(String serType);

    List<OrderList> findByStoreIdOrderByCreateTimeDesc(String id);


    List<OrderList> findByStoreIdAndDelFlagAndFlag(String id, int i, int i1);

    @Modifying
    @Query(value ="SELECT * FROM `js_order` where store_name like %:message% or ser_type like %:message%",  nativeQuery = true)
    List<OrderList> findAllBySerTypeLikeOrStoreNameLike(@Param(value = "message") String message);

}


